<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
    <meta name="generator" content="AsciiDoc 8.2.5" />
    <link rel="stylesheet" href="xhtml11.css" type="text/css" />
    <link rel="icon" href="chrome://vimperator/skin/icon.png" type="image/png" />
    <script type="application/x-javascript;version=1.8" src="help.js"></script>
    <title>autocommands.html</title>
  </head>
<body>
<h1 style="font-size: inherit; text-align: right;">
  <span class="tag" style="float: none;">autocommands.html</span>
</h1>
<div class="para"><p><div style="float: right; padding-left: 1px;"> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <fieldset class="paypal"> <input type="hidden" name="cmd" value="_s-xclick"/> <input type="image" src="" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/> <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBDDJfc+lXLBSAM9XSWv/ebzG/L7PTqYiIXaWVg8pfinDsfYaAcifcgCTuApg4v/VaZIQ/hLODzQu2EvmjGXP0twErA/Q8G5gx0l197PJSyVXb1sLwd1mgOdLF4t0HmDCdEI9z3H6CMhsb3xVwlfpzllSfCIqzlSpx4QtdzEZGzLDELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQI8ZOwn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gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA3MDMyMTIyMzI1OFowIwYJKoZIhvcNAQkEMRYEFCirrvlwYVHQiNEEbM6ikfx9+Dm5MA0GCSqGSIb3DQEBAQUABIGAtbsR8GdCdURLziozXLSdtY+zJZUPPeQFXXy2V1S/3ldiN+pRvd4HI7xz8mOY1UaKJZpwZnOosy9MflL1/hbiEtEyQ2Dm/s4jnTcJng/NjLIZu+0NYxXRJhB+zMJubnMMMjzNrGlqI4F2HAB/bCA1eOJ5B83Of3dA4rk/T/8GoSQ=-----END PKCS7-----"/> </fieldset> </form> </div> <span class="vimperator-logo"></span></p></div>
<div class="para"><p><span class="tag">autocommands</span><br /></p></div>
<div class="para"><p>Autocommands are a way to automatically execute code when certain events
happen.</p></div>
<div class="para"><p><span class="tag">:au</span> <span class="tag">:autocmd</span><br />
<div class="key">:au[tocmd]</div></p></div>
<div class="quoteblock">
<div class="content">
<div class="para"><p>Execute commands automatically on events.</p></div>
<div class="para"><p><a class="command" href="#">:au[tocmd]</a> <span class="argument">&#123;event&#125;</span> <span class="argument">&#123;pat&#125;</span> <span class="argument">&#123;cmd&#125;</span></p></div>
<div class="para"><p>Add <span class="argument">&#123;cmd&#125;</span> to the list of commands Vimperator will execute on <span class="argument">&#123;event&#125;</span> for a URL matching <span class="argument">&#123;pat&#125;</span>:</p></div>
<div class="ilist"><ul>
<li>
<p>
<a class="command" href="#">:autocmd<span class="argument">&#91;!&#93;</span></a> <span class="argument">&#123;events&#125;</span> <span class="argument">&#123;pat&#125;</span>: list/remove autocommands filtered by <span class="argument">&#123;events&#125;</span> and <span class="argument">&#123;pat&#125;</span>
</p>
</li>
<li>
<p>
<a class="command" href="#">:autocmd<span class="argument">&#91;!&#93;</span></a> <span class="argument">&#123;events&#125;</span>: list/remove autocommands matching <span class="argument">&#123;events&#125;</span>
</p>
</li>
<li>
<p>
<a class="command" href="#">:autocmd<span class="argument">&#91;!&#93;</span></a> * <span class="argument">&#123;pat&#125;</span>: list/remove autocommands matching <span class="argument">&#123;pat&#125;</span>
</p>
</li>
<li>
<p>
<a class="command" href="#">:autocmd<span class="argument">&#91;!&#93;</span></a>: list/remove all autocommands
</p>
</li>
</ul></div>
<div class="para"><p>Available <span class="argument">&#123;events&#125;</span>:</p></div>
<div class="tableblock">
<table rules="none"
frame="hsides"
cellspacing="0" cellpadding="4">
<col width="240" />
<col width="468" />
<tbody valign="top">
  <tr>
    <td align="left">
    <strong>BookmarkAdd</strong>
    </td>
    <td align="left">
    Triggered after a page is bookmarked
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>ColorScheme</strong>
    </td>
    <td align="left">
    Triggered after a color scheme has been loaded
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>DOMLoad</strong>
    </td>
    <td align="left">
    Triggered when a page's DOM content has fully loaded
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>DownloadPost</strong>
    </td>
    <td align="left">
    Triggered when a download has completed
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>Fullscreen</strong>
    </td>
    <td align="left">
    Triggered when the browser's fullscreen state changes
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>LocationChange</strong>
    </td>
    <td align="left">
    Triggered when changing tabs or when navigating to a new location
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>PageLoadPre</strong>
    </td>
    <td align="left">
    Triggered after a page load is initiated
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>PageLoad</strong>
    </td>
    <td align="left">
    Triggered when a page gets (re)loaded/opened
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>ShellCmdPost</strong>
    </td>
    <td align="left">
    Triggered after executing a shell command with <a class="command" href="">:!</a><span class="argument">&#123;cmd&#125;</span>
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>VimperatorEnter</strong>
    </td>
    <td align="left">
    Triggered after Firefox starts
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>VimperatorLeavePre</strong>
    </td>
    <td align="left">
    Triggered before exiting Firefox, just before destroying each module
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>VimperatorLeave</strong>
    </td>
    <td align="left">
    Triggered before exiting Firefox
    </td>
  </tr>
</tbody>
</table>
</div>
<div class="para"><p><span class="argument">&#123;pat&#125;</span> is a regular expression, use .* if you want to match all URLs.</p></div>
<div class="para"><p><span class="info">Note:</span> This differs from Vim which uses a glob rather than a regexp for <span class="argument">&#123;pat&#125;</span>.</p></div>
<div class="para"><p>The following keywords are available where relevant:</p></div>
<div class="tableblock">
<table rules="none"
frame="hsides"
cellspacing="0" cellpadding="4">
<col width="171" />
<col width="537" />
<tbody valign="top">
  <tr>
    <td align="left">
    <strong>&lt;url&gt;</strong>
    </td>
    <td align="left">
    The URL against which the event was selected.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;title&gt;</strong>
    </td>
    <td align="left">
    The page, bookmark or download title.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;tab&gt;</strong>
    </td>
    <td align="left">
    The tab in which the event occurred.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;tags&gt;</strong>
    </td>
    <td align="left">
    The tags applied to &lt;url&gt;. Only for <strong>BookmarkAdd</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;keyword&gt;</strong>
    </td>
    <td align="left">
    The keywords applied to the bookmark. Only for <strong>BookmarkAdd</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;icon&gt;</strong>
    </td>
    <td align="left">
    The icon associated with &lt;url&gt;. Only for <strong>BookmarkAdd</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;size&gt;</strong>
    </td>
    <td align="left">
    The size of a downloaded file. Only for <strong>DownloadPost</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;file&gt;</strong>
    </td>
    <td align="left">
    The target destination of a download. Only for <strong>DownloadPost</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;state&gt;</strong>
    </td>
    <td align="left">
    The new fullscreen state. Only for <strong>Fullscreen</strong>.
    </td>
  </tr>
  <tr>
    <td align="left">
    <strong>&lt;name&gt;</strong>
    </td>
    <td align="left">
    The color scheme name. Only for <strong>ColorScheme</strong>.
    </td>
  </tr>
</tbody>
</table>
</div>
<div class="attribution">
</div></div></div>
<div class="para"><p><span class="tag">:doautoa</span> <span class="tag">:doautoall</span>
<div class="key">:doautoa[ll] <span class="argument">&#123;event&#125;</span> <span class="argument">[url]</span></div><br /></p></div>
<div class="quoteblock">
<div class="content">
<div class="para"><p>Apply the autocommands matching the specified URL to all buffers. If no
<span class="argument">[url]</span> is specified use the current URL.</p></div>
<div class="attribution">
</div></div></div>
<div class="para"><p><span class="tag">:do</span> <span class="tag">:doautocmd</span>
<div class="key">:do[autocmd] <span class="argument">&#123;event&#125;</span> <span class="argument">[url]</span></div><br /></p></div>
<div class="quoteblock">
<div class="content">
<div class="para"><p>Apply the autocommands matching the specified URL to the current buffer. If no
<span class="argument">[url]</span> is specified use the current URL.</p></div>
<div class="attribution">
</div></div></div>
<div class="para"><p><table style="border-bottom: 1px solid silver; width: 100%">
<tr style="width: 100%"><td style="width: 50%"><h2>Examples</h2></td><td style="width: 50%">


 <a id="autocmd-examples"/><span class="tag">autocmd-examples</span>
</td></tr>
</table></p></div>
<div class="para"><p>Enable <em>passthrough</em> mode on all Google sites:</p></div>
<div class="para"><p>&#160;<a class="command" href="#">:autocmd LocationChange .* js modes.passAllKeys = /google\.com/.test(buffer.URL)</a></p></div>
<div class="para"><p>Enable <em>passthrough</em> mode on <strong>some</strong> Google sites:</p></div>
<div class="para"><p>&#160;<a class="command" href="#">:autocmd LocationChange .* js modes.passAllKeys = /(www|mail)\.google\.com/.test(buffer.URL)</a></p></div>
<div class="para"><p>Set the filetype to mail when editing email at Gmail:</p></div>
<div class="para"><p>&#160;<a class="command" href="">:autocmd LocationChange .* :set editor=gvim\ -f</a><br />
&#160;<a class="command" href="">:autocmd LocationChange mail\.google\.com :set editor="gvim -f -c <a class="option" href="#">'set ft=mail'</a>"</a></p></div>
<div id="footer">
<div id="footer-text">
Last updated 2009-02-28 20:06:30 IST
</div>
</div>
</body>
</html>
